package Leetcode;

/**
 * @Author MJS
 * @Date 2021/12/25 16:35
 * @Description
 */
public class SumTwoNumbers {

    public static void main(String[] args) {
        int[] nums={1,7,50,21,6};
        int target =71;
        SumTwoNumbers sumTwoNumbers = new SumTwoNumbers();
        System.out.println(sumTwoNumbers.twoSum(nums, target));
    }


    public int[] twoSum(int [] nums , int target){
        int [] a = new int [2];
        int i = 0;
        int j = 0;
        for (int k = 0; k < nums.length; k++) {
            for (int g = k + 1; g <nums.length; g++) {
                if(a[k] + a[g] == target){
                    a[0] =k;
                    a[1] = g;
                    return a;
                }

            }

        }
       return a;
    }
}
